package com.zzyl.controller.app;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.controller.BaseController;
import com.zzyl.entity.NursingProject;
import com.zzyl.service.NursingProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AppRoomProjectController extends BaseController {
    @Autowired
    private NursingProjectService nursingProjectService;

    //分页查询
    @GetMapping("/customer/orders/project/page")
    public ResponseResult getByPage(String name, Integer status,
                                 @RequestParam(defaultValue = "1")Integer pageNum,
                                 @RequestParam(defaultValue = "10")Integer pageSize){
        PageResponse<NursingProject> pagelist = nursingProjectService.getByPage(name, status, pageNum, pageSize);
        return ResponseResult.success(pagelist);
    }

    //根据编号查询服务详情
    @GetMapping("/customer/orders/project/{id}")
    public ResponseResult getById(@PathVariable("id") Long id){
        NursingProject nursingProject = nursingProjectService.getById(id);
        return success(nursingProject);
    }
}
